﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.VersionControl.Client;
using Tfs_analyzer;

namespace Tfs_analyzer.BaseValidators
{
  class AttachedWorkItemsValidator : IChangesetValidator
  {
    IValidationResult IChangesetValidator.CheckChangeset(Changeset i_changeset_to_analyze, IEnumerable i_changesets)
    {
      ValidationResult res = new ValidationResult();

      if (i_changeset_to_analyze.AssociatedWorkItems.Length <= 2)
        {
        res.SetMark(1);
        res.SetReason("Associated WI count lq than 2");
        }
      else if (i_changeset_to_analyze.AssociatedWorkItems == null)
        {
        res.SetMark(-2);
        res.SetReason("No associated WI");
        }
      else
        {
        res.SetMark(-2);
        res.SetReason("No associated WIs");
        }
      return res;
    }
  }
}
